package demo.icanci.pattern.callback;

/**
 * 事件监听器模式 一旦事件发生，就做出反应
 * 
 * 事件源 event source
 * 事件监听器 event listener
 * 事件对象 event object
 * 
 * @author icanci
 * @date Created in 2021/02/18 23:16
 * @version 1.0
 */
public class CallbackDemo {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            System.out.println("我要休息了");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("CallbackDemo.main");
            System.out.println("我被回调了");
        });
        thread.start();
    }
}
